<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE-edge">
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<title>main</title>
<link rel="stylesheet" type="text/css" href="./bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
<script src="./js/vue.js"></script>
<script src="./js/axios.min.js"></script>
</head>
<body>
	<div class="container" id="app" v-show="canshow">
		<h1>{{msg}}</h1>
		<h2>{{user}}</h2>
		<a href="./my/loginout.do">注销</a>
	</div>
</body>
</html>
<script>
	var vue = new Vue({
		el:'#app',
		data:{
			msg:'用户主页',
			canshow:false,
			user:{
				username:'',
				password:''
			}
		},
		methods:{
			init:function(){
				axios.get('/ZhuCeDengLu/my/main.do').then(function(result){
					console.log(result);
					if(result.data.status=="0"){
						console.log(result.data.data);
						vue.user=result.data.data;
						vue.canshow=true;
						console.log(this.user);
					}else if(result.data.status=="2"){
						alert("当前用户未登录");
						document.location.herf="login.html";
					}else{
						alert(result.data.msg);
					}
						
				}).catch(function(err){
					alert("你用的移动吧");
				})
			}
		},
		mounted:function(){
			console.log("inited..");
			this.init();
		}
	});
	
</script>